<template>
	<view class="content">
		<view class="none" v-if="teamList.length == 0">
			<i class="iconfont iconwujilu"></i>
			<view>暂无人员</view>
		</view>
		<view class="team" v-for="(item,index) in teamList" :key="index" v-else>
			<image :src="item.headimg ? item.headimg :'/static/image/logo.png'" mode="aspectFill"></image>
			<view class="name">{{item.teacher_name}}</view>
			<view>证书编号：{{item.certificate_no}}</view>
		</view>
		<uni-load-more v-if="teamList.length >= 13" :status="status" :content-text="contentText" />
	</view>
</template>

<script>
	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
	export default{
		components: {
			uniLoadMore
		},
		data() {
			return {
				teamList: [],
				page: 1,
				reload: true,
				status: 'more',
				contentText: {
					contentdown: '上拉加载更多',
					contentrefresh: '加载中',
					contentnomore: '没有更多',
					contentnot: "没数据"
				}
			}
		},
		onPullDownRefresh() {
			this.page = 1;
			this.reload = true;
			this.getList();
			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		onReachBottom() {
			this.status = 'loading';
			this.page = this.page + 1;
			var _this = this;
			setTimeout(function() {
				_this.getList();
			}, 500);
		},
		onLoad() {
			this.getList();
		},
		methods: {
			getList() {
				var data = {
					institute_id: 1,
					page: this.page,
					limit: 15
				};
				this.$zbapi.apiPost('teacher/front/teacher/infos',data).then(res=>{
					if (res.data.code == 200 && res.data.data.list) {
						var list = res.data.data.list;
						this.teamList = this.reload ? list : this.teamList.concat(list);
						this.reload = false;
						this.status = 'more';
					} else {
						if (this.reload) {
							this.teamList = [];
						} else {
							this.status = 'noMore';
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.content{
		padding-bottom: 100upx;
	}
	.none{
		margin-top: 200upx;
		text-align: center;
		width: 100%;
		& i{
			color: #FF9900;
			line-height: 1;
			font-size: 400upx;
		}
		& view{
			color: #999999;
			font-size: 36upx;
		}
	}
	.team{
		height: 100upx;
		display: flex;
		justify-content: flex-start;
		align-items: center;
		padding: 0 30upx;
		&:nth-child(odd) {
			background-color: #FFFFFF;
		}
		&:nth-child(even) {
			background-color: rgba(255,153,0, 0.05);
		}
		& image{
			width: 60upx;
			height: 60upx;
			border-radius: 50%;
			margin-right: 20upx;
		}
		.name {
			width: 22%;
		}
	}
</style>
